package com.szgr.baoyin.activity;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.szgr.baoyin.R;
import com.szgr.baoyin.utils.Constant;

/**
 * 租赁协议
 */
public class LeaseProtocolActivity extends BaseActivity {

    private WebView webView1;
    private WebView webView2;
    private Button btn_click;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_lease_protocol);
        super.onCreate(savedInstanceState);
    }

    @Override
    public void initActionBar() {
        actionBarTitle.setText("租赁协议");
    }

    @Override
    public void initView() {
        btn_click = (Button) findViewById(R.id.protocol_open_or_close);
        btn_click.setOnClickListener(this);

        webView1 = (WebView) findViewById(R.id.lease_web_view_01);
        WebSettings settings1 = webView1.getSettings();
        settings1.setJavaScriptEnabled(true);
        webView1.loadUrl(Constant.URL_ZULIN);

        webView2 = (WebView) findViewById(R.id.lease_web_view_02);
        WebSettings settings2 = webView2.getSettings();
        settings2.setJavaScriptEnabled(true);
        webView2.loadUrl(Constant.URL_ZULIN);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.action_bar_left:
                finish();
                break;
            case R.id.protocol_open_or_close:
                if(webView1.getVisibility() == View.VISIBLE){
                    webView1.setVisibility(View.GONE);
                    webView2.setVisibility(View.VISIBLE);
                    btn_click.setText("收起");
                }else{
                    webView1.setVisibility(View.VISIBLE);
                    webView2.setVisibility(View.GONE);
                    btn_click.setText("点击查看全文");
                }

                break;
        }
    }
}
